<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <ui:composition template="ClientTemplate.xhtml">   
        <ui:define name="body">  
            <h:form>           
                <p:growl id="noticeMessage" />  
                <h:outputText escape="false" value="You are not the login"  rendered="#{empty loginController.userLogin}"/>
                <h:outputText escape="false" value="Not Order" rendered="#{orderController.items.rowCount == 0}"/>
                <h:panelGroup rendered="#{orderController.items.rowCount > 0}">
                    <p:dataTable var="item" value="#{orderController.listUserOrder(loginController.userLogin.usID)}" 
                                 paginator="true" rows="5" paginatorPosition="bottom"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 rowsPerPageTemplate="5,10,15" style="width:100%" widgetVar="roomTable" resizableColumns="true">
                        <f:facet name="header">
                            <h:outputText value="List of Order History" />                            

                        </f:facet>
                        <p:ajax event="rowEdit" listener="#{orderController.onEdit}" />
                        <p:ajax event="rowEditCancel" listener="#{orderController.onEditCancel}" />

                        <p:column sortBy="#{item.odID}" headerText="ID"  >          
                            <h:outputText value="#{item.odID}"/>
                        </p:column>

                        <p:column sortBy="#{item.usID.usUserName}" headerText="User" >                       
                            <p:outputLabel value="#{item.usID.usUserName}" id="usID" />                       
                        </p:column>
                        <p:column sortBy="#{item.mnID.mnName}" headerText="Manager" >
                            <h:outputText value="#{item.mnID.mnName}"/>  
                        </p:column>

                        <p:column sortBy="#{item.odCity}" headerText="City" >
                            <h:outputText value="#{item.odCity}"/>
                        </p:column>

                        <p:column sortBy="#{item.odCountry}" headerText="Country">
                            <h:outputText value="#{item.odCountry}"/> 
                        </p:column>

                        <p:column sortBy="#{item.odCreated}" headerText="Created Date"
                                  filterBy="#{item.odCreated}">                      
                            <h:outputText value="#{item.odCreated}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                            </h:outputText>
                        </p:column>

                        <p:column sortBy="#{item.odTotal}" headerText="Total" 
                                  filterBy="#{item.odTotal}"  >                      
                            <h:outputText value="#{item.odTotal}"/> 
                        </p:column>
                        <p:column headerText="Status" sortBy="#{item.odStatus}">
                            <h:outputText value="#{item.odStatus}"/>                   
                        </p:column> 
                        <!--cot hien thi các nút xóa, ...view ...-->
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value=""/>
                            </f:facet>
                            <p:commandButton action="#{orderController.prepareViewDetailByClient(item)}"   icon="ui-icon-extlink"                                             
                                             title="Detail" value="Detail"  >
                            </p:commandButton>  

                        </p:column>
                    </p:dataTable>
                    <br />        
                </h:panelGroup>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

